package jzqb.dao.impl;

import cnki.tpi.kbatis.sqlsession.SqlSession;
import cnki.tpi.kbatis.utils.DataSourceUtil;
import haha.life.common.BelongToSqlUtils;
import jzqb.bo.AdminQueryBo;
import jzqb.dao.AdminZTDao;
import jzqb.dao.AdminZTJDao;
import jzqb.po.ZTJPo;
import jzqb.po.ZTPo;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * 专题数据层实现类
 */
@Repository
public class AdminZTDaoImpl implements AdminZTDao {

    @Override
    public Boolean updateZT(ZTPo ztPo) {
        SqlSession sqlSession = DataSourceUtil.getSqlSession();
        String statementId = "jzqb.dao.AdminZTDao.updateZT";
        return sqlSession.executeUpdate(statementId,ztPo);
    }

    @Override
    public Boolean insertZT(ZTPo ztPo) {
        SqlSession sqlSession = DataSourceUtil.getSqlSession();
        String statementId = "jzqb.dao.AdminZTDao.insertZT";
        return sqlSession.executeInsert(statementId,ztPo);
    }

    @Override
    public Boolean deleteZT(String delSql) {
        SqlSession sqlSession = DataSourceUtil.getSqlSession();
        String statementId = "jzqb.dao.AdminZTDao.deleteZT";
        return sqlSession.executeDelete(statementId, delSql);
    }

    @Override
    public List<ZTPo> queryZT(AdminQueryBo bo) {
        SqlSession sqlSession = DataSourceUtil.getSqlSession();
        String statementId = "jzqb.dao.AdminZTDao.queryZT";
        return sqlSession.selectList(statementId, bo, false);
    }

    @Override
    public Long countZT(AdminQueryBo bo) {
        SqlSession sqlSession = DataSourceUtil.getSqlSession();
        String statementId = "jzqb.dao.AdminZTDao.countZT";
        return sqlSession.getCount(statementId, bo);
    }

    @Override
    public List<ZTPo> queryZTList(AdminQueryBo bo) {
        SqlSession sqlSession = DataSourceUtil.getSqlSession();
        String statementId = "jzqb.dao.AdminZTDao.queryZTList";
        return sqlSession.selectList(statementId, bo, false);
    }

    @Override
    public List<ZTPo> queryNameAndId(ZTPo ztPo) {
        SqlSession sqlSession = DataSourceUtil.getSqlSession();
        String statementId = "jzqb.dao.AdminZTDao.queryNameAndId";
        return sqlSession.selectList(statementId, ztPo, false);
    }



}
